package com.it.a01polymorphism;

public class Test {
    public static void main(String[] args) {
        //创建三个对象
        Student s = new Student();
        s.setName("学生");
        s.setAge(23);

        Teacher t = new Teacher();
        t.setName("老师");
        t.setAge(22);

        Administrator a = new Administrator();
        a.setName("管理员");
        a.setAge(22);

        register(s);
        register(t);
        register(a);

    }


    //这个方法既能接收学生，还能接收管理员
    //只能把参数写出这三类型的父类
    public static void register(Person p){
        p.show();
    }
}
